package com.cloud.mall.user.service.impl;

import com.cloud.mall.base.BaseResponse;
import com.cloud.mall.core.bean.MallBeanUtils;
import com.cloud.mall.ums.mapper.UmsMemberLevelMapper;
import com.cloud.mall.ums.model.UmsMemberLevel;
import com.cloud.mall.ums.model.UmsMemberLevelExample;
import com.cloud.mall.user.output.UmsMemberLevelOut;
import com.cloud.mall.usr.service.UmsMemberLevelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class UmsMemberLevelServiceImpl implements UmsMemberLevelService {

    @Autowired
    private UmsMemberLevelMapper memberLevelMapper;

    @Override
    public BaseResponse<List<UmsMemberLevelOut>> list(Integer defaultStatus) {
        UmsMemberLevelExample example = new UmsMemberLevelExample();
        example.createCriteria().andDefaultStatusEqualTo(defaultStatus);
        List<UmsMemberLevel> umsMemberLevelList= memberLevelMapper.selectByExample(example);
        return BaseResponse.setResultSuccess(MallBeanUtils.copyDoToDto(umsMemberLevelList, UmsMemberLevelOut.class));
    }


  }
